{% extends "layout.html" %}
{% block body %}
    <div class="well editPanel">
        <h2>Edit Card #{{ card.id }}</h2>
        <form action="{{ url_for('edit_card') }}" method="post" class="cardForm">

            <div class="form-group">
                {% for tag in tags %}
                    <label for={{tag.tagName}} class="toggleButton btn btn-default btn-lg">{{tag.tagName}} &nbsp;
                        <input type="radio" name="type" value={{tag.id}}
                            id={{tag.tagName}} {{ "checked" if (card.type == tag.id) else "" }} />
                    </label>
                {% endfor %}

                <!-- <label for="general" class="btn btn-default btn-lg">General &nbsp;
                    <input type="radio" name="type" value="1"
                           id="general" {{ "checked" if (card.type == 1) else "" }} />
                </label>
                <label for="code" class="btn btn-default btn-lg">Code &nbsp;
                    <input type="radio" name="type" value="2" id="code" {{ "checked" if (card.type == 2) else "" }} />
                </label> -->
            </div>
            <div class="form-group">
                <label for="front">Front of Card</label>
                <input type="text" name="front" id="front" class="form-control" value="{{ card.front|e }}">
            </div>
            <div class="form-group">
                <label for="back">Back of Card</label>
                <textarea name="back"
                          class="form-control"
                          id="back"
                          placeholder="back of card"
                          rows="12">{{ card.back|e }}</textarea>
            </div>
            <div class="row">
                <div class="col-xs-6">
                    <div class="checkbox">
                        <label>
                            <input type="checkbox" name="known"
                               value="1" {{ "checked" if (card.known == 1) else "" }} /> Known
                        </label>
                    </div>
                </div>
                <div class="col-xs-6 text-right">
                    <a href="{{ url_for('delete', card_id=card.id) }}" class="btn btn-danger btn-xs">
                        <i class="fa fa-trash"></i>
                        Remove
                    </a>
                </div>
            </div>

            <hr />
            <div class="form-group">
                <input type="hidden" name="card_id" value="{{ card.id|e }}" />
                <button type="submit" class="saveButton btn btn-lg btn-primary">Save</button>
            </div>
        </form>
    </div>
{% endblock %}
